<script setup lang="ts">
import {loadConfigJSON} from "@/utils/config";
import {configStoreKey, initBrowserError} from "@/utils/constants";
import {browserDriver, config} from "@/store/modules/globals";
// import { ElConfigProvider } from 'element-plus';
// import { ref } from 'vue';

// const language= ref();


if (!browserDriver.restoreStorageToObject) {
  throw initBrowserError;
}
let result = browserDriver.restoreStorageToObject(configStoreKey);
if (result) {
  if (result instanceof Promise) {
    result.then((configJson) => {
      // console.log("configJson", configJson);
      if (!configJson) {
        return;
      }
      let restoreConfig = loadConfigJSON(configJson);
      // console.log("restoreConfig", restoreConfig);
      // console.log("config", config);
      config.fromConfig(restoreConfig);
    })
  }
  else {
    let restoreConfig = loadConfigJSON(result);
    // console.log("restoreConfig", restoreConfig);
    // console.log("config", config);
    config.fromConfig(restoreConfig);
  }
}
console.log("初始化完成。")
</script>

<template>
<!--  <el-config-provider :locale="language">-->
<!--    <router-view></router-view>-->
<!--  </el-config-provider>-->
  <router-view></router-view>
</template>

<style>
#app {
  display: flex;
  justify-content: center;
  /* align-items: center; */
  height: 100vh;
  flex-direction: row;
}
body {
  margin: 0;
}
::-webkit-scrollbar {
  width: 5px;
  background-color: #f0f0f0;
}
::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 5px;
}
::-webkit-scrollbar-track {
  border: 1px solid #ccc;
}
</style>
